package main

import (
	"fmt"
	"runtime"
)

func main() {
	num := runtime.NumCPU()
	fmt.Println("CPU数量：", num)
	//1.5版本之后默认是多核并发执行，大于2即为多核执行
	runtime.GOMAXPROCS(2)
	fmt.Println(`NumCgoCall:`, runtime.NumCgoCall())
	percentOfMem := runtime.MemProfileRate
	fmt.Println("go版本：", runtime.Version(), "内存占用率：", percentOfMem)

	fmt.Println("num of goroutine:", runtime.NumGoroutine())
	var chin = make(chan int)
	go func(i int) {
		chin <- i
	}(10)
	fmt.Println(chin)

	// ch := make(channel int)
	// var chanSend channel <- int = ch
	// <-chanSend

}
